package com.demo;

import java.util.*;

public class Question2 {
    public static void main(String[] args) {
        String string = "999";
        TreeMap<Character, Integer> tm = new TreeMap<Character, Integer>();
        Set<Character> st = tm.keySet();
        char[] c = string.toCharArray();
        for (int x = 0; x < c.length; x++) {
            if (!st.contains(c[x])) {
                tm.put(c[x], 1);
            } else {
                tm.put(c[x], tm.get(c[x]) + 1);
            }
        }
        Set<Character> out = tm.keySet();
        Iterator<Character> ti = out.iterator();
        for (; ti.hasNext(); ) {
            char key = ti.next();
            System.out.println(key + ":" + tm.get(key));
        }
    }
}
